﻿using ConsoleApp5.Models;
using System;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            string constr = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Test;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
            using (SqlConnection con = new SqlConnection(constr))
            {
                con.Open();
                Northwind db = new Northwind(con);
                IQueryable<Customers> query =
                     db.Customers.Where(c => c.City == "Shenzhen").Where(c => c.CustomerID == "1000");

                Console.WriteLine("Query:\n{0}\n", query);
                var list = query.ToList();
                foreach (var item in list)
                {
                    Console.WriteLine("{0}|{1}|{2}|{3}", item.CustomerID, item.ContactName, item.City, item.Country);
                }
            }
            Console.ReadKey();
        }
    }
}

